package cn.zcscloud.mall.controller;

import cn.zcscloud.mall.common.R;
import cn.zcscloud.mall.mbg.model.CmsPrefrenceArea;
import cn.zcscloud.mall.service.CmsPrefrenceAreaService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/prefrenceArea")
public class CmsPrefrenceAreaController {

    @Autowired
    private CmsPrefrenceAreaService cmsPrefrenceAreaService;

    /**
     * 获取所有商品优选
     *
     * @return
     */
    @GetMapping("/listAll")
    public R<List<CmsPrefrenceArea>> listAll() {
        LambdaQueryWrapper<CmsPrefrenceArea> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(CmsPrefrenceArea::getSort);
        List<CmsPrefrenceArea> list = cmsPrefrenceAreaService.list(lqw);
        return R.success(list);
    }
}
